//my header
#include "stdafx.h"

//calculates the various city ratings based on the various city stats
void Calculations(int pop, int sqMil, int pollu, int crime, int expense, int highway, double PopDens, 
			double *PolluAmt, double *TrafficRating, double *CrimePerCap, double *ExpensePerCap){
		
		//calculates the pollution ammount based on the polution and Population Density and casts 1000 as a double to ensure result is a double
		*PolluAmt = (pollu * PopDens) / ((double)1000);

		//calculates crime per capita based on crime, the population density and the Crime Constant
		*CrimePerCap = (crime * PopDens) / CrimeConstant;

		//calculates Expense Per Capita based on expense, population density and an Expense Constant 
		*ExpensePerCap = (expense * PopDens) / ExpenseConstant;

		//calculates the traffic rating based on the population density and the traffic constant and casts highway as a double to ensure the result is a double
		;*TrafficRating = (PopDens * TrafficConstant) / ((double)highway)

}				

//calculates the population density				
void PopDensCalc(int pop, int sqMil, double *PopDens){
	
	/*calculates the population density based on total population and square mileage 
	and casts the square mileage as a double to ensure the result is a double*/
	*PopDens = (pop/((double)sqMil));
	
}

//calculates the livability percent
void LivabilityCalc(char city [] , char BestCity [], double PolluAmt, double TrafficRating, double CrimePerCap, double ExpensePerCap, double *Livability, double *BestRating){
	
	//Calculates livability based on various statistics of each city and the Livability Constant
	*Livability = 100 - (PolluAmt + TrafficRating + CrimePerCap + ExpensePerCap) / LivabilityConstant;
	
	/*compares livability to "BestRating" 	and if greter sets Compare to livability also it sets the current city
	to the BestCity when this condition is true */
	if(*Livability > *BestRating){
		*BestRating = *Livability;
		strcpy(BestCity, city);
		
	}
		
}